<template>
	<div class="Login">
		<div class="con">
			<div class="con_top">
				<img src="../../assets/logo.png" alt="" />
			</div>
			<el-form 
					ref="form"
					label-width="110px"
					class="demo-ruleForm">
				<el-form-item label="旧密码" prop="adminPassword">
					<el-input v-model="admin.adminPassword" ></el-input>
				</el-form-item>
				<el-form-item label="新密码" prop="newPassword">
					<el-input type="password" v-model="admin.newPassword" ></el-input>
				</el-form-item>
				<el-form-item label="再次新密码" prop="newPassword2">
					<el-input type="password" v-model="admin.newPassword2"></el-input>
				</el-form-item>
				<el-form-item class="dl">
					<el-button type="primary" @click="adminUpdatePassword()">点击修改密码</el-button>
				</el-form-item>
			</el-form>
		</div>
	</div>
</template>


<script>
	export default {
		data() {
			return {
				admin:{
					adminPassword:'',
					newPassword:'',
					newPassword2:'',
					adminId:JSON.parse(sessionStorage.getItem("admin")).adminId,
					adminTel:JSON.parse(sessionStorage.getItem("admin")).adminTel,	
					adminSalt:JSON.parse(sessionStorage.getItem("admin")).adminSalt,
				},
				

			}
		},

		methods: {
			adminUpdatePassword(){
				if(this.admin.newPassword!=this.admin.newPassword2){
					alert("两次密码输入不一致!!")
				}else{
					this.$axios.post("/admin/updatePassword",this.admin)
					.then(res=>{
						if(res.data.code==200){
							alert(res.data.message);
							this.$router.push("/");
							alert("请您重新登陆！");
						}else{
							alert(res.data.data);
						}
					})
				}
			},





		},



		
	};
</script>

<style scoped>
	* {
		margin: 0;
		padding: 0;
	}
	.dl {
		float: auto;
	}
	.el-form {
		width: 90%;
	}
	.Login {
		height: 100%;
		width: 100%;
		background-color: #1a4c6b;
	}
	
	.con {
		width: 500px;
		height: 330px;
		background-color: white;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
	}
	
	.con_top {
		height: 130px;
		width: 130px;
		border-radius: 50%;
		border: 10px solid white;
		background-color: #eeeeee;
		overflow: hidden;
		position: absolute;
		top: -50%;
		left: 50%;
		transform: translate(-50%, 50%);
		box-shadow: 0 2px 10px rgba(114, 114, 114);
	}
	
	.con_top img {
		height: 130px;
	}
	
	.el-form {
		margin-top: 100px;
	}
	
	.login {
		float: right;
		margin-right: 38px;
	}
</style>